#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>
#include<stdlib.h>
#include<string.h>

char* addBinary(char* a, char* b) {
    int len1 = strlen(a);
    int len2 = strlen(b);
    int len = len1 > len2 ? len1 : len2 + 1;
    int next = 0;
    int i = len1 - 1, j = len2 - 1;
    char* ans = (char*)malloc(sizeof(char) * len);
    int z = 0;
    while (i >= 0 || j >= 0)
    {
        int x = i < 0 ? 0 : a[i] - '0';
        int y = j < 0 ? 0 : b[j] - '0';
        ans[z++] = (x + y + next) % 2 + '0';
        next = (x + y + next) / 2;
        i--;
        j--;
    }
    if (next)
    {
        ans[z++] = '1';
    }
    int left = 0, right = z - 1;
    while (left < right)
    {
        int tmp = ans[left];
        ans[left] = ans[right];
        ans[right] = tmp;
        left++;
        right--;
    }
    ans[z] = '\0';
    return ans;
}

int main()
{
    char str1[] = {"0"};
    char str2[] = {"0"};
    printf("%s ",addBinary(str1, str2));
    return 0;
}